<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="stylesheet" href="../../style.css" type="text/css" media="screen">
<link rel="stylesheet" href="../../print.css" type="text/css" media="print">
<meta content="Thread,ender.threads.Thread,HIGH_PRIORITY,LOW_PRIORITY,NORMAL_PRIORITY,NO_PRIORITY,URGENT_PRIORITY,_priority,_runnable,priority,runnable,isFirstRun,run,start,stop,yield" name="keywords">
<title>ender.threads.Thread</title>
</head>
<body>
<script type="text/javascript" language="javascript" src="../../asdoc.js"></script><script type="text/javascript" language="javascript" src="../../cookies.js"></script><script type="text/javascript" language="javascript">
<!--
				asdocTitle = 'Thread - API Documentation';
				var baseRef = '../../';
				window.onload = configPage;
			--></script>
<table style="display:none" id="titleTable" cellspacing="0" cellpadding="0" class="titleTable">
<tr>
<td align="left" class="titleTableTitle">API Documentation</td><td align="right" class="titleTableTopNav"><a onclick="loadClassListFrame('../../all-classes.html')" href="../../package-summary.html">All&nbsp;Packages</a>&nbsp;|&nbsp;<a onclick="loadClassListFrame('../../all-classes.html')" href="../../class-summary.html">All&nbsp;Classes</a>&nbsp;|&nbsp;<a onclick="loadClassListFrame('../../index-list.html')" href="../../all-index-A.html">Index</a>&nbsp;|&nbsp;<a href="../../index.html?ender/threads/Thread.html&amp;ender/threads/class-list.html" id="framesLink1">Frames</a><a onclick="parent.location=document.location" href="" style="display:none" id="noFramesLink1">No&nbsp;Frames</a></td><td rowspan="3" align="right" class="titleTableLogo"><img alt="Adobe Logo" title="Adobe Logo" class="logoImage" src="../../images/logo.jpg"></td>
</tr>
<tr class="titleTableRow2">
<td align="left" id="subTitle" class="titleTableSubTitle">Class&nbsp;Thread</td><td align="right" id="subNav" class="titleTableSubNav"><a href="#propertySummary">Properties</a>&nbsp;| <a href="#methodSummary">Methods</a>&nbsp;| <a href="#constantSummary">Constants</a></td>
</tr>
<tr class="titleTableRow3">
<td colspan="2">&nbsp;</td>
</tr>
</table>
<script type="text/javascript" language="javascript">
<!--
if (!isEclipse() || window.name != ECLIPSE_FRAME_NAME) {titleBar_setSubTitle("Class Thread"); titleBar_setSubNav(true,true,false,false,false,false,true,false,false,false,false,false,false,false);}
--></script>
<div class="MainContent">
<table cellspacing="0" cellpadding="0" class="classHeaderTable">
<tr>
<td class="classHeaderTableLabel">Package</td><td><a onclick="javascript:loadClassListFrame('class-list.html')" href="package-detail.html">ender.threads</a></td>
</tr>
<tr>
<td class="classHeaderTableLabel">Class</td><td class="classSignature">public class Thread</td>
</tr>
<tr>
<td class="classHeaderTableLabel">Implements</td><td><a href="IRunnable.html">IRunnable</a>, <a href="IThread.html">IThread</a></td>
</tr>
</table>
<p></p>
  The Thread class is the primary thread in the system.  It allows you to create threads,
  start and stop them, set priority, and handles all interaction with the ThreadManager
  singleton.
  
  All threads can be created by extending the Thread class directly and overriding run(). 
  <p></p>
<br>
<hr>
</div>
<a name="propertySummary"></a>
<div class="summarySection">
<div class="summaryTableTitle">Public Properties</div>
<table id="summaryTableProperty" class="summaryTable " cellpadding="3" cellspacing="0">
<tr>
<th>&nbsp;</th><th colspan="2">Property</th><th class="summaryTableOwnerCol">Defined&nbsp;by</th>
</tr>
<tr class="">
<td class="summaryTablePaddingCol">&nbsp;</td><td class="summaryTableInheritanceCol">&nbsp;</td><td class="summaryTableSignatureCol"><a class="signatureLink" href="#priority">priority</a> : int<div class="summaryTableDescription"> 
   The priority the thread should be run at.</div>
</td><td class="summaryTableOwnerCol">Thread</td>
</tr>
<tr class="">
<td class="summaryTablePaddingCol">&nbsp;</td><td class="summaryTableInheritanceCol">&nbsp;</td><td class="summaryTableSignatureCol"><a class="signatureLink" href="#runnable">runnable</a> : <a href="../threads/IRunnable.html">IRunnable</a>
<div class="summaryTableDescription">[read-only]
   The IRunnable object that the thread is set to process.</div>
</td><td class="summaryTableOwnerCol">Thread</td>
</tr>
</table>
</div>
<a name="protectedPropertySummary"></a>
<div class="summarySection">
<div class="summaryTableTitle">Protected Properties</div>
<table id="summaryTableProtectedProperty" class="summaryTable " cellpadding="3" cellspacing="0">
<tr>
<th>&nbsp;</th><th colspan="2">Property</th><th class="summaryTableOwnerCol">Defined&nbsp;by</th>
</tr>
<tr class="">
<td class="summaryTablePaddingCol">&nbsp;</td><td class="summaryTableInheritanceCol">&nbsp;</td><td class="summaryTableSignatureCol"><a class="signatureLink" href="#_priority">_priority</a> : int = 600<div class="summaryTableDescription">
   The priority the thread should be run at.</div>
</td><td class="summaryTableOwnerCol">Thread</td>
</tr>
<tr class="">
<td class="summaryTablePaddingCol">&nbsp;</td><td class="summaryTableInheritanceCol">&nbsp;</td><td class="summaryTableSignatureCol"><a class="signatureLink" href="#_runnable">_runnable</a> : <a href="../threads/IRunnable.html">IRunnable</a>
<div class="summaryTableDescription"> The IRunnable object that the thread is set to process.</div>
</td><td class="summaryTableOwnerCol">Thread</td>
</tr>
</table>
</div>
<a name="methodSummary"></a>
<div class="summarySection">
<div class="summaryTableTitle">Public Methods</div>
<table id="summaryTableMethod" class="summaryTable " cellpadding="3" cellspacing="0">
<tr>
<th>&nbsp;</th><th colspan="2">Method</th><th class="summaryTableOwnerCol">Defined&nbsp;by</th>
</tr>
<tr class="">
<td class="summaryTablePaddingCol">&nbsp;</td><td class="summaryTableInheritanceCol">&nbsp;</td><td class="summaryTableSignatureCol">
<div class="summarySignature">
<a class="signatureLink" href="#Thread()">Thread</a>(runnable:<a href="IRunnable.html">IRunnable</a> = null, priority:int)</div>
<div class="summaryTableDescription"> 
   Constructor.</div>
</td><td class="summaryTableOwnerCol">Thread</td>
</tr>
<tr class="">
<td class="summaryTablePaddingCol">&nbsp;</td><td class="summaryTableInheritanceCol">&nbsp;</td><td class="summaryTableSignatureCol">
<div class="summarySignature">
<a class="signatureLink" href="#isFirstRun()">isFirstRun</a>(thread:<a href="IRunnable.html">IRunnable</a>):Boolean</div>
<div class="summaryTableDescription">[static]
   If this is the thread's first time being execute, returns true.</div>
</td><td class="summaryTableOwnerCol">Thread</td>
</tr>
<tr class="">
<td class="summaryTablePaddingCol">&nbsp;</td><td class="summaryTableInheritanceCol">&nbsp;</td><td class="summaryTableSignatureCol">
<div class="summarySignature">
<a class="signatureLink" href="#run()">run</a>():void</div>
<div class="summaryTableDescription">
   Abstract IRunnable implemention of run().</div>
</td><td class="summaryTableOwnerCol">Thread</td>
</tr>
<tr class="">
<td class="summaryTablePaddingCol">&nbsp;</td><td class="summaryTableInheritanceCol">&nbsp;</td><td class="summaryTableSignatureCol">
<div class="summarySignature">
<a class="signatureLink" href="#start()">start</a>():void</div>
<div class="summaryTableDescription">
   Starts the thread.</div>
</td><td class="summaryTableOwnerCol">Thread</td>
</tr>
<tr class="">
<td class="summaryTablePaddingCol">&nbsp;</td><td class="summaryTableInheritanceCol">&nbsp;</td><td class="summaryTableSignatureCol">
<div class="summarySignature">
<a class="signatureLink" href="#stop()">stop</a>():void</div>
<div class="summaryTableDescription">
   Stops the thread.</div>
</td><td class="summaryTableOwnerCol">Thread</td>
</tr>
<tr class="">
<td class="summaryTablePaddingCol">&nbsp;</td><td class="summaryTableInheritanceCol">&nbsp;</td><td class="summaryTableSignatureCol">
<div class="summarySignature">
<a class="signatureLink" href="#yield()">yield</a>():void</div>
<div class="summaryTableDescription">[static]
   Yields execution.</div>
</td><td class="summaryTableOwnerCol">Thread</td>
</tr>
</table>
</div>
<a name="constantSummary"></a>
<div class="summarySection">
<div class="summaryTableTitle">Public Constants</div>
<table id="summaryTableConstant" class="summaryTable " cellpadding="3" cellspacing="0">
<tr>
<th>&nbsp;</th><th colspan="2">Constant</th><th class="summaryTableOwnerCol">Defined&nbsp;by</th>
</tr>
<tr class="">
<td class="summaryTablePaddingCol">&nbsp;</td><td class="summaryTableInheritanceCol">&nbsp;</td><td class="summaryTableSignatureCol"><a class="signatureLink" href="#HIGH_PRIORITY">HIGH_PRIORITY</a> : int = 300<div class="summaryTableDescription">[static] Process the thread with high priority.</div>
</td><td class="summaryTableOwnerCol">Thread</td>
</tr>
<tr class="">
<td class="summaryTablePaddingCol">&nbsp;</td><td class="summaryTableInheritanceCol">&nbsp;</td><td class="summaryTableSignatureCol"><a class="signatureLink" href="#LOW_PRIORITY">LOW_PRIORITY</a> : int = 1200<div class="summaryTableDescription">[static] Process the thread with low priority.</div>
</td><td class="summaryTableOwnerCol">Thread</td>
</tr>
<tr class="">
<td class="summaryTablePaddingCol">&nbsp;</td><td class="summaryTableInheritanceCol">&nbsp;</td><td class="summaryTableSignatureCol"><a class="signatureLink" href="#NO_PRIORITY">NO_PRIORITY</a> : int = 10000<div class="summaryTableDescription">[static] Never process the thread.</div>
</td><td class="summaryTableOwnerCol">Thread</td>
</tr>
<tr class="">
<td class="summaryTablePaddingCol">&nbsp;</td><td class="summaryTableInheritanceCol">&nbsp;</td><td class="summaryTableSignatureCol"><a class="signatureLink" href="#NORMAL_PRIORITY">NORMAL_PRIORITY</a> : int = 600<div class="summaryTableDescription">[static] Process the thread with normal priority (default).</div>
</td><td class="summaryTableOwnerCol">Thread</td>
</tr>
<tr class="">
<td class="summaryTablePaddingCol">&nbsp;</td><td class="summaryTableInheritanceCol">&nbsp;</td><td class="summaryTableSignatureCol"><a class="signatureLink" href="#URGENT_PRIORITY">URGENT_PRIORITY</a> : int = 150<div class="summaryTableDescription">[static] Process the thread with urgent priority.</div>
</td><td class="summaryTableOwnerCol">Thread</td>
</tr>
</table>
</div>
<script type="text/javascript" language="javascript">
<!--
showHideInherited();
--></script>
<div class="MainContent">
<a name="propertyDetail"></a>
<div class="detailSectionHeader">Property detail</div>
<a name="_priority"></a>
<table cellspacing="0" cellpadding="0" class="detailHeader">
<tr>
<td class="detailHeaderName">_priority</td><td class="detailHeaderType">property</td>
</tr>
</table>
<div class="detailBody">
<code>protected var _priority:int = 600</code><p>
   The priority the thread should be run at.  The lower the value,
   the higher the priority. See Thread constants for declared values.
   </p></div>
<a name="priority"></a>
<table cellspacing="0" cellpadding="0" class="detailHeader">
<tr>
<td class="detailHeaderName">priority</td><td class="detailHeaderType">property</td><td class="detailHeaderRule">&nbsp;</td>
</tr>
</table>
<div class="detailBody">
<code>priority:int</code>&nbsp;&nbsp;[read-write]<p> 
   The priority the thread should be run at.  The lower the value,
   the higher the priority. See Thread constants for declared values.
   </p><span class="label">Implementation</span>
<br>
<code>&nbsp;&nbsp;&nbsp;&nbsp;public function get priority():int</code>
<br>
<code>&nbsp;&nbsp;&nbsp;&nbsp;public function set priority(value:int):void</code>
<br>
</div>
<a name="_runnable"></a>
<table cellspacing="0" cellpadding="0" class="detailHeader">
<tr>
<td class="detailHeaderName">_runnable</td><td class="detailHeaderType">property</td><td class="detailHeaderRule">&nbsp;</td>
</tr>
</table>
<div class="detailBody">
<code>protected var _runnable:<a href="../threads/IRunnable.html">IRunnable</a></code><p> The IRunnable object that the thread is set to process. </p></div>
<a name="runnable"></a>
<table cellspacing="0" cellpadding="0" class="detailHeader">
<tr>
<td class="detailHeaderName">runnable</td><td class="detailHeaderType">property</td><td class="detailHeaderRule">&nbsp;</td>
</tr>
</table>
<div class="detailBody">
<code>runnable:<a href="../threads/IRunnable.html">IRunnable</a></code>&nbsp;&nbsp;[read-only]<p>
   The IRunnable object that the thread is set to process.
   </p><span class="label">Implementation</span>
<br>
<code>&nbsp;&nbsp;&nbsp;&nbsp;public function get runnable():<a href="../threads/IRunnable.html">IRunnable</a></code>
<br>
</div>
<a name="constructorDetail"></a>
<div class="detailSectionHeader">Constructor detail</div>
<a name="Thread()"></a>
<table cellspacing="0" cellpadding="0" class="detailHeader">
<tr>
<td class="detailHeaderName">Thread</td><td class="detailHeaderParens">()</td><td class="detailHeaderType">constructor</td>
</tr>
</table>
<div class="detailBody">
<code>public function Thread(runnable:<a href="IRunnable.html">IRunnable</a> = null, priority:int)</code><p> 
   Constructor.
   
   </p><span class="label">Parameters</span>
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="20px"></td><td><code><span class="label">runnable</span>:<a href="IRunnable.html">IRunnable</a></code> (default = <code>null</code>)<code></code> &mdash; The IRunnable object to process.  If null, defaults to the Thread itself.
   </td>
</tr>
<tr>
<td class="paramSpacer">&nbsp;</td>
</tr>
<tr>
<td width="20px"></td><td><code><span class="label">priority</span>:int</code></td>
</tr>
</table>
</div>
<a name="methodDetail"></a>
<div class="detailSectionHeader">Method detail</div>
<a name="isFirstRun()"></a>
<table cellspacing="0" cellpadding="0" class="detailHeader">
<tr>
<td class="detailHeaderName">isFirstRun</td><td class="detailHeaderParens">()</td><td class="detailHeaderType">method</td>
</tr>
</table>
<div class="detailBody">
<code>public static function isFirstRun(thread:<a href="IRunnable.html">IRunnable</a>):Boolean</code><p>
   If this is the thread's first time being execute, returns true.  Else, false.
   Useful for initializing loop constructs and other items.
   </p><span class="label">Parameters</span>
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="20px"></td><td><code><span class="label">thread</span>:<a href="IRunnable.html">IRunnable</a></code></td>
</tr>
</table>
<p></p>
<span class="label">Returns</span>
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="20"></td><td><code>Boolean</code></td>
</tr>
</table>
</div>
<a name="run()"></a>
<table cellspacing="0" cellpadding="0" class="detailHeader">
<tr>
<td class="detailHeaderName">run</td><td class="detailHeaderParens">()</td><td class="detailHeaderType">method</td><td class="detailHeaderRule">&nbsp;</td>
</tr>
</table>
<div class="detailBody">
<code>public function run():void</code><p>
   Abstract IRunnable implemention of run().  This ustbe overridden, or an
   exception will be thrown.
   </p></div>
<a name="start()"></a>
<table cellspacing="0" cellpadding="0" class="detailHeader">
<tr>
<td class="detailHeaderName">start</td><td class="detailHeaderParens">()</td><td class="detailHeaderType">method</td><td class="detailHeaderRule">&nbsp;</td>
</tr>
</table>
<div class="detailBody">
<code>public function start():void</code><p>
   Starts the thread.
   </p></div>
<a name="stop()"></a>
<table cellspacing="0" cellpadding="0" class="detailHeader">
<tr>
<td class="detailHeaderName">stop</td><td class="detailHeaderParens">()</td><td class="detailHeaderType">method</td><td class="detailHeaderRule">&nbsp;</td>
</tr>
</table>
<div class="detailBody">
<code>public function stop():void</code><p>
   Stops the thread.
   </p></div>
<a name="yield()"></a>
<table cellspacing="0" cellpadding="0" class="detailHeader">
<tr>
<td class="detailHeaderName">yield</td><td class="detailHeaderParens">()</td><td class="detailHeaderType">method</td><td class="detailHeaderRule">&nbsp;</td>
</tr>
</table>
<div class="detailBody">
<code>public static function yield():void</code><p>
   Yields execution. This stops thread processing and lets the ThreadManager
   process the next thread in the queue.  This should be called by implemented threads
   since the Flash Player can't do this itself.
   
   Your run() implementation can also simply call return, but yield() is more explicit and
   can be called from any method within your thread.
   
   Use discretion in your threads.  You should call yield() based on time or iteration
   count, or if you've done a segment of processing that satisfies the code enough.
   There is no limit to how long your thread can occupy the Player, but keep in mind
   that the application will be locked up AT LEAST until you yield execution.
   </p></div>
<a name="constantDetail"></a>
<div class="detailSectionHeader">Constant detail</div>
<a name="HIGH_PRIORITY"></a>
<table cellspacing="0" cellpadding="0" class="detailHeader">
<tr>
<td class="detailHeaderName">HIGH_PRIORITY</td><td class="detailHeaderType">constant</td>
</tr>
</table>
<div class="detailBody">
<code>public static const HIGH_PRIORITY:int = 300</code><p> Process the thread with high priority. </p></div>
<a name="LOW_PRIORITY"></a>
<table cellspacing="0" cellpadding="0" class="detailHeader">
<tr>
<td class="detailHeaderName">LOW_PRIORITY</td><td class="detailHeaderType">constant</td><td class="detailHeaderRule">&nbsp;</td>
</tr>
</table>
<div class="detailBody">
<code>public static const LOW_PRIORITY:int = 1200</code><p> Process the thread with low priority. </p></div>
<a name="NO_PRIORITY"></a>
<table cellspacing="0" cellpadding="0" class="detailHeader">
<tr>
<td class="detailHeaderName">NO_PRIORITY</td><td class="detailHeaderType">constant</td><td class="detailHeaderRule">&nbsp;</td>
</tr>
</table>
<div class="detailBody">
<code>public static const NO_PRIORITY:int = 10000</code><p> Never process the thread. </p></div>
<a name="NORMAL_PRIORITY"></a>
<table cellspacing="0" cellpadding="0" class="detailHeader">
<tr>
<td class="detailHeaderName">NORMAL_PRIORITY</td><td class="detailHeaderType">constant</td><td class="detailHeaderRule">&nbsp;</td>
</tr>
</table>
<div class="detailBody">
<code>public static const NORMAL_PRIORITY:int = 600</code><p> Process the thread with normal priority (default). </p></div>
<a name="URGENT_PRIORITY"></a>
<table cellspacing="0" cellpadding="0" class="detailHeader">
<tr>
<td class="detailHeaderName">URGENT_PRIORITY</td><td class="detailHeaderType">constant</td><td class="detailHeaderRule">&nbsp;</td>
</tr>
</table>
<div class="detailBody">
<code>public static const URGENT_PRIORITY:int = 150</code><p> Process the thread with urgent priority. </p></div>
<br>
<br>
<hr>
<br>
<p></p>
<center class="copyright"> 
</center>
</div>
</body>
</html>
<!-- -->
